package com.aytbayev.resmi;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

import android.content.res.Resources;

public class MyInstrument {
	private String ticker;
	private String nin;
	private String instrName;
	private float rest;
	private String currencyName;	
	private float blocked;
	private byte isBond;
	private String holdingPlace;
	
	public MyInstrument() {		
	}
	
	public String getFullTicker() {
		return ticker;
	}
	
	public String getNin() {
		return nin;
	}
	
	public String getInstrumentName() {
		return instrName;
	}
	
	public String getCurrencyName(Resources r) {		
		if (currencyName.equals(r.getString(R.string.GBP_replace))) {
            return "GBP";
	    } else if (currencyName.equals(r.getString(R.string.USD_replace))) {
	            return "USD";
	    } else if (currencyName.equals(r.getString(R.string.KZT_replace))) {
	            return "KZT";
	    } else {
	            return currencyName;
	    }
	}
		
	public float getFreeAmount() {
		return rest;
	}
	
	public float getBlockedAmount() {
		return blocked;
	}
	
	public byte isBond() {
		return isBond;
	}
	
	public String getHoldingPlace() {
		return holdingPlace;
	}
	
	public String format(float a) {
		if ( a != 0){
			DecimalFormatSymbols formatSymbols =  new DecimalFormatSymbols();
		    formatSymbols.setGroupingSeparator(' ');
	
		    DecimalFormat myFormatter = new DecimalFormat("###,###.##", formatSymbols);
		    return myFormatter.format(a);
		} else {
			return "0";
		}
	}
}
